*Do file for the IV-2SLS models and marginal effects in "Tolerating Threat? The Independendent Effects of Civil Conflict on Domestic Political Tolerance"

*open .dta file titled "macro-micro_stata_data"


***********************************************************************
*To produce models found in Table 2

*Model 1
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (cowcivwar5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 2
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (flcivwar5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 3
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (priocivwar5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 4
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (ac5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 5
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (acdeaths5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 6
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (terrorattks2=rugterrain miltper miltexp), cluster(ccode) first cue nocollin


***********************************************************************
*To produce the full sample models from Table 6a found in the web appendix (border changes)

*Model 1-4
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 borderchange (cowcivwar5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 4-4
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 borderchange (ac5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 6-4
ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 borderchange (terrorattks2=rugterrain miltper miltexp), cluster(ccode) first cue nocollin


***********************************************************************
*To produce the no border changes models from Table 6a found in the web appendix (border change)
***Please note:  You must split the sample so the * has been added to these commands so they will not automatically run in this file.

*drop if borderchange==1

*Model 1-5
*ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (cowcivwar5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 4-5
*ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (ac5=rugterrain miltper miltexp), cluster(ccode) first cue nocollin

*Model 6-5
*ivreg2 tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 (terrorattks2=rugterrain miltper miltexp), cluster(ccode) first cue nocollin


***********************************************************************
*To generate the marginal effects from Table 4 - requires Clarify software

*Attitudinal variables and Socio-Economic Characteristics
estsimp ologit tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ, cluster(ccode)
setx mean

*Democratic Activism
simqi, fd(pr) changex(demact min max)

*Value Free Speech
simqi, fd(pr) changex(vfsindx min max)

*Conformity
simqi, fd(pr) changex(conform min max)

*Female
simqi, fd(pr) changex(female 0 1)

*Age
simqi, fd(pr) changex(age min max)

*Education
simqi, fd(pr) changex(educ min max)
drop b1-b12


*Civil Conflict variables
*Civil War - COW
estsimp ologit tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 cowcivwar5e, cluster(ccode)
setx mean
simqi, fd(pr) changex(cowcivwar5e 0 1)
drop b1-b16

*Civil War - Fearon & Laitin
estsimp ologit tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 flcivwar5e, cluster(ccode)
setx mean
simqi, fd(pr) changex(flcivwar5e 0 1)
drop b1-b16

*Civil War - PRIO
estsimp ologit tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 priocivwar5e, cluster(ccode)
setx mean
simqi, fd(pr) changex(priocivwar5e 0 1)
drop b1-b16

*Internal Armed Conflicts
estsimp ologit tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 ac5e, cluster(ccode)
setx mean
simqi, fd(pr) changex(ac5e min max)
drop b1-b16

*Internal Armed Conflict fatalities
estsimp ologit tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 acdeaths5e, cluster(ccode)
setx mean
simqi, fd(pr) changex(acdeaths5e min max)
drop b1-b16

*Fatal Terrorist Attacks
estsimp ologit tol demact polintindx demideal vfsindx conform freqtv selfpolid female age educ contdem ef HDI95 terrorattks2e, cluster(ccode)
setx mean
simqi, fd(pr) changex(terrorattks2e min max)
drop b1-b16
